import { financeSubType } from '@/const/risk';
import { ObjectType } from '../utils';

/**
 * 选择调整类型，过滤出当前对应的细分类型的项
 * @param currentId Number 调整类型项的id
 * @return Array
 */
export function getSubTypeData(currentId: number) {
  return financeSubType.filter((val: ObjectType) => {
    if (typeof val.relativeId === 'number' && val.relativeId === currentId) {
      return val;
    }
    if (val.relativeId instanceof Array && val.relativeId.includes(currentId)) {
      return val;
    }
    return null;
  });
}
